home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / mathstud.zip / SETGRID.M < prev    next >
Text File  |  1993-03-23  |  985b  |  38 lines

  1. function y=setgrid(x)
  2. %setgrid    provides fine control of grid options for 2D plots
  3. %    change the default values for any subsequent plot
  4. %
  5. %  x is a logical vector whose values are as follows
  6. %
  7. %  x(1) - Allow X axis not to end on tick marks (linear plot only)
  8. %  x(2) - Allow Y axis not to end on tick marks (linear plot only)
  9. %  x(3) - Place unlabeld X axis at top of plotting area
  10. %  x(4) - Place unlabeld Y axis at right of plotting area
  11. %  x(5) - Do not plot X axis tick labels (controlled by grid)
  12. %  x(6) - Do not plot Y axis tick labels (controlled by grid)
  13. %  x(7) - Set the tick marks inside the plotting area
  14. %  x(8) - Include X axis grid lines
  15. %  x(9) - Include Y axis grid lines
  16. %
  17. %  x=[1 1 1 1 0 0 1 1 1]  is the default
  18. %  y=463
  19.  
  20. %       S.Halevy 7/31/92
  21. %       Copyright (c) 1992 by the MathWizards
  22.  
  23. x=(x>0);
  24. x=x(:);
  25.  
  26. n=length(x);
  27. if n > 9
  28.   x=x(1:9);
  29.   x=x(:);
  30. end
  31.  
  32. n = length(x);
  33. y=0;
  34. if n>1
  35.    wght = 2^((1:n)-1);
  36.    y=wght*x;
  37. end
  38.